const state = {
	opened: sessionStorage.getItem('open') ? sessionStorage.getItem('open') : 'false',
	org_code: null, // todo 需要获取
	roleValue: 'mechanism',
	org_list: [], // 机构列表
	org_msg: {}
}
const mutations = {
	SET_OPENED (state, payload) {
		state.opened = String(payload)
		sessionStorage.setItem('open', payload)
	},
	SET_ORG_CODE (state, payload) {
		state.org_code = payload
		localStorage.setItem('org_code', payload)
	},
	// 角色改变
	SET_ROLE_VALUE: (state, roleValue) => {
		state.roleValue = roleValue
		sessionStorage.setItem(roleValue, roleValue.role)
	},
	// 机构信息
	SET_ORG_MSG: (state, org_msg) => {
		state.org_msg = org_msg
		localStorage.setItem('org_msg', JSON.stringify(org_msg))
	},
	// 机构列表
	SET_ORG_LIST: (state, org_list) => {
		console.log(org_list)
		state.org_list = [
			...org_list
		]
	}
}
export default {
	namespaced: true,
	state,
	mutations
}
